// 评估日志管理
<template>
  <div class="app-container">
  <el-card class="box-card" shadow="never" style="border:0px;">
      <div slot="header" style="color:#303133;font-size:14px;font-weight:bold;">
        <span>评估日志</span>
      </div>
    <div class="filter-container" id="searchBox">
      <div class="left">
        <el-form :inline="true" class="demo-form-inline" size="medium" label-position="right">
          <el-form-item label="案例编号：">
            <el-input v-model="listQuery.caseId" clearable class="filter-item" placeholder="请输入案例编号（CaseID）" />
          </el-form-item>
          <el-form-item label="请求状态：">
            <el-select v-model="listQuery.requestStatus" style="width:100%;" placeholder="请选择">
              <el-option label="失败" :value="0"></el-option>
              <el-option label="成功" :value="1"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="评估人姓名：">
            <el-input v-model="listQuery.creatorName" clearable class="filter-item" placeholder="请输入评估人姓名" />
          </el-form-item>
        <el-form-item label="开始时间：">
              <el-date-picker
                class="date_item"
                v-model="listQuery.startDate"
                type="date"
                placeholder="选择开始时间"
                align="right"
                value-format="yyyy-MM-dd">
              </el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间：">
              <el-date-picker
              class="date_item"
                v-model="listQuery.endDate"
                type="date"
                placeholder="选择结束时间"
                align="right"
                value-format="yyyy-MM-dd">
              </el-date-picker>
        </el-form-item>
        </el-form>
      </div>
      <div class="right">
        <el-button type="primary" @click="listEvLog(listQuery)">查询</el-button>
        <el-button @click="restForm">重置</el-button>
        <el-button  type="text" @click="closeSearch">{{showOperation}}<i :class="[!showAll? 'el-icon-caret-bottom' : 'el-icon-caret-top']"></i>
               </el-button>
      </div>
    </div>
    <vxe-toolbar ref="xToolbar">
         <template #buttons>
         </template>
    </vxe-toolbar>
    <vxe-table
      v-loading="loading"
      :data="taskData"
      border="none"
      highlight-hover-row
      show-header-overflow
      show-overflow
      align="left"
      :header-cell-style="{ background: '#F7F7F8', color: '#606266' }"
          @cell-dblclick="cellDblclick"
    >
      <vxe-table-column title="案例编号" fixed="left" field="caseId" width="130" />
      <vxe-table-column title="行政区划编码" field="divisionId" width="100"/>
      <vxe-table-column title="物业完整地址" field="address"  width="150"/>
      <vxe-table-column title="评估单价" field="unitPrice"  width="80"/>
      <vxe-table-column title="评估总价" field="totalPrice"  width="80"/>
      <vxe-table-column title="环比" field="priceRingRate"  width="80"/>
      <vxe-table-column title="同比" field="priceYearRate"  width="80"/>
      <vxe-table-column title="询价时间" field="queryDate"  width="80"/>
      <vxe-table-column title="案例均价" field="avgUnitPrice"  width="80" />
      <vxe-table-column title="楼盘均价" field="avgPrice"  width="80"/>
      <vxe-table-column title="最大单价" field="maxPrice"  width="80"/>
      <vxe-table-column title="最小单价" field="minPrice"  width="80"/>
      <vxe-table-column title="物业费" field="mangerPrice" width="80" />
      <vxe-table-column title="活跃度" field="liveness"  width="80"/>
      <vxe-table-column title="总套数" field="totalCellNumber"  width="80"/>
      <vxe-table-column title="近3个月被查询次数" field="queryCount"  width="150"/>
      <vxe-table-column title="估价状态" field="returnCode"  width="80"/>
      <vxe-table-column title="返回信息" field="remark"  width="80"/>
      <vxe-table-column title="建成年代" field="endDate"  width="140"/>
      <vxe-table-column title="楼盘名称" field="constructionName"  width="80"/>
      <vxe-table-column title="楼盘别名" field="constructionAlias"  width="80"/>
      <vxe-table-column title="楼栋名称" field="buildingName"  width="80"/>
      <vxe-table-column title="房号名称" field="houseName"  width="80"/>
      <vxe-table-column title="房屋用途" field="propertyType"  width="80"/>
      <vxe-table-column title="案例数量" field="quotationCount" width="80" />
      <vxe-table-column title="项目ID" field="projectId" width="130" />
      <vxe-table-column title="房产ID" field="houseId" width="130" />
      <vxe-table-column title="评估人" field="creatorName" width="100" />
      
      <vxe-table-column title="请求参数JSON" field="requestParam"  width="150"/>
      <!-- <vxe-table-column title="失败原因" fixed="right" field="failReason"  width="150"/> -->
       <vxe-table-column title="请求状态" fixed="right"  width="80">
        <template v-slot="{ row }">
          <el-button type="primary" size="small" round v-if="row.requestStatus == 1">成功</el-button>
          <el-button type="success" size="small" round v-else @click="errorReason(row.failReason)">失败</el-button>
        </template>
      </vxe-table-column>
    </vxe-table>
  </el-card>
    <vxe-pager
      class="pager"
      @page-change="changePage"
      :current-page.sync="listQuery.pageNo"
      :page-size.sync="listQuery.pageSize"
      :total="total"
      :page-sizes="[5, 10, 30, 50, 100]"
      :layouts="['PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
    >
    </vxe-pager>
  </div>
</template>

<script>
import { listEvaluation } from '@/api/evaluation';
export default {
  name: 'User',
  data: function () {
    return {
      active: 0,
      taskData: [],
      total: 0,
      loading: true,
      listQuery: {
        pageNo: 1,
        pageSize: 10,
        caseId: undefined,
        requestStatus: 1,
        creatorName: undefined,
        startDate: undefined,
        endDate: undefined,
      },
      showAll:true,
    };
  },
  computed: {
    showOperation: function() {
   if (this.showAll == false) {
    //对文字进行处理
    return "展开";
   } else {
    return "收起";
   }
  }
  },
  mounted(){
  /**
   * 收起搜索
   */
  this.$nextTick(function() {
   this.closeSearch();
  });
  },  
  created () {
    this.listEvLog();
  },
  // getTask
  methods: {
    // 列表查询
    listEvLog() {
      this.loading = true;
      this.taskId = this.$route.query.taskId;
      listEvaluation(this.listQuery).then((data) => {
        this.taskData = data.data;
        this.total = data.total;
        this.loading = false;
      });
    },
    changePage() {
      this.listEvLog();
    },
  closeSearch() {
   this.showAll = !this.showAll;
   var searchBoxHeght = document.getElementById("searchBox");
   if (this.showAll == false) {
    searchBoxHeght.style.height = 50 + "px";
   } else {
    searchBoxHeght.style.height = "auto";
   }
  },
    errorReason(remark) {
        this.$alert(remark, '失败原因', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `action: ${ action }`
            });
          }
        });
      },
    restForm() {
      this.listQuery = {
        pageNo: 1,
        pageSize: 10,
        receiveName: undefined,
        receivePhone: undefined
      };
      this.listEvLog();
    },
    cellDblclick({row,rowIndex,column,columnIndex,cell},event) {
      let _this = this;
      this.$copyText(event.target.innerText).then(function() {
        _this.$message.info('复制成功');
      });
    }
  },

};
</script>

<style lang="css" scoped>
.filter-container {
  display: flex;
  justify-content: space-between;
}
#searchBox {
 overflow: hidden;
}

.pager{
  position: fixed;
  bottom: 0;
  right: 28px;
  background-color: #FAFAFB;
  z-index: 2;
  height: 40px;
  width: calc(100% - 260px);
  }

.right >>> .el-button--primary,.el-button--default {
  padding: 10px 20px;
}

.vxe-table--render-default >>> .el-button--text{
  color: #2b7bfb;
}
.app-container >>> .vxe-table--render-default,.vxe-pager {
  font-family: PingFangSC, Arial, Helvetica, sans-serif;
} 

.left {
  flex: 14;
  display: flex;
  flex-flow: row wrap;
  margin-right: 20px;
}
.left >>> .el-form {
  width: 100%;
}
.left >>> .el-form .el-form-item {
  display: flex;
  flex-flow: row nowrap;
  width: 30%;
  margin-right: 3%;
  float: left;
  margin-bottom: 14px;
}

.left >>> .el-form .el-form-item .el-form-item__label {
  font-weight: 500;
  color: #606266;
  text-align: left;
  /* flex: 1; */
}

.left >>> .el-form .el-form-item .el-form-item__content {
  flex: 1;
  /*超出部分隐藏*/
  text-overflow: ellipsis;
  /* 超出部分显示省略号 */
  white-space: nowrap;
  /*规定段落中的文本不进行换行 */
  width: 100%;
}
.date_item {
  width: 100%;
}
.right {
  flex: 2;
  display: flex;
  flex-flow: row nowrap;
  align-items: flex-end;
  margin-right: 30px;
}
</style>
